package com.homework.work04;

import java.util.Arrays;

public class Array_ {
    public static void main(String[] args) {
        //数组翻转
        int[] arr={11,22,33,44,55,66};
        for (int i=0;i<arr.length/2;i++){
            int temp = arr[arr.length-1-i];
            arr[arr.length-1-i] = arr[i];
            arr[i] = temp;
        }
        for (int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        bubble01(arr);
        System.out.println(Arrays.toString(arr));
    }
    //冒泡排序
    public static void bubble01(int[] arr) {
        int temp = 0;
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
    }
}
